//
//  SinglePayNetwork.m
//  Shengzhuli
//
//  Created by 卡忙科技 on 16/8/16.
//  Copyright © 2016年 kamangkeji. All rights reserved.
//

#import "SinglePayNetwork.h"
#import "GFXNetworkHandle.h"
#import "SingleListModel.h"

NSString * const CheckPayPsw = @"auth/member/check/login/pwd";//验证支付密码
NSString * const BalancePay = @"auth/balance/pay";//余额支付
NSString * const CheckPaySuccess = @"auth/show/pay/result";//支付验证
NSString * const LookSuccessPay = @"auth/order/buy/list/by/payNumber";//查看订单


@implementation SinglePayNetwork

+ (void)checkPswWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg))response
{
    [[GFXNetworkHandle shareHandle]post:CheckPayPsw params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            response(YES,json[@"message"]);
        }else{
            response(NO,json[@"message"]);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError);
    }];
}

+ (void)balancePayWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg))response
{
    [[GFXNetworkHandle shareHandle]post:BalancePay params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            response(YES,json[@"message"]);
        }else{
            response(NO,json[@"message"]);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError);
    }];
}

+ (void)checkPaySuccessWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg))response
{
    [[GFXNetworkHandle shareHandle]post:CheckPaySuccess params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            response(YES,json[@"message"]);
        }else{
            response(NO,json[@"message"]);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError);
    }];
}

+ (void)lookSuccessPayListWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg,NSArray *lists))response
{
    [[GFXNetworkHandle shareHandle]post:LookSuccessPay params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            NSMutableArray *lists = [NSMutableArray array];
            for (NSDictionary *dict in json[@"result"]) {
                SingleListModel *model = [SingleListModel objectWithDict:dict];
                [lists addObject:model];
            }
            response(YES,json[@"message"],lists);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];
}


@end
